package org.jeecg.modules.demo.zyExam.zyexamaddpaper.service.impl;

import org.jeecg.modules.demo.zyExam.zyexamaddpaper.entity.ZyExamAddPaper;
import org.jeecg.modules.demo.zyExam.zyexamaddpaper.mapper.ZyExamAddPaperMapper;
import org.jeecg.modules.demo.zyExam.zyexamaddpaper.service.IZyExamAddPaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;
import java.util.Map;

/**
 * @Description: 出卷
 * @Author: jeecg-boot
 * @Date:   2024-01-07
 * @Version: V1.0
 */
@Service
public class ZyExamAddPaperServiceImpl extends ServiceImpl<ZyExamAddPaperMapper, ZyExamAddPaper> implements IZyExamAddPaperService {

    @Autowired
    private ZyExamAddPaperMapper zyExamAddPaperMapper;

    @Override
    public List<ZyExamAddPaper> queryBySubject(String subject) {
        List<ZyExamAddPaper> zyExamAddPapers = zyExamAddPaperMapper.queryBySubject(subject);
        String source_code= zyExamAddPapers.get(0).getSource();
        String source=zyExamAddPaperMapper.querySource(source_code);
        for (ZyExamAddPaper zyExamAddPaper : zyExamAddPapers) {
            zyExamAddPaper.setSource(source);
        }
        return  zyExamAddPapers;
    }

    @Override
    public List<Map<String,String>> getAllPaper() {
        return zyExamAddPaperMapper.getAllPaper();
    }

    @Override
    public void deleteByPaperCode(String id) {
        zyExamAddPaperMapper.deleteByPaperCode(id);
    }
}
